//
//  UITextField+lvfj.m
//  lvfj
//
//  Created by lvfeijun on 2020/2/29.
//  Copyright © 2020 Goudu KuaiEx Technology(Shenzhen)Co.,ltd. All rights reserved.
//

#import "UITextField+lvfj.h"

//becomeFirstResponder 要在viewDidAppear 否则会卡...模拟器不弹起键盘,会push2次
@implementation UITextField (lvfj)

-(void)setPlaceholder:(NSString *)placeholder color:(UIColor *)color font:(UIFont *)font{
    self.borderStyle = UITextBorderStyleRoundedRect;
    NSString *holderText = placeholder;
    NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:holderText];
    [placeholder addAttribute:NSForegroundColorAttributeName
                            value:color
                            range:NSMakeRange(0, holderText.length)];
    [placeholder addAttribute:NSFontAttributeName
                            value:font
                            range:NSMakeRange(0, holderText.length)];
    self.attributedPlaceholder = placeholder;
}

@end
